//
//  WMEClubListTableViewCell.m
//  everyDay_duiTang
//
//  Created by 恩叔 on 16/2/29.
//  Copyright © 2016年 enshu. All rights reserved.
//

#import "WMEClubListTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface WMEClubListTableViewCell ()
@property (nonatomic, retain)UIImageView *clubImg;/**<用户图片*/
@property (nonatomic, retain)UILabel *clubName;/**<用户名*/
@property (nonatomic, retain)UILabel *clubType;/**<用户类型*/
@property (nonatomic, retain)UILabel *clubmember;/**<用户成员*/
@end

@implementation WMEClubListTableViewCell
- (void)dealloc
{
    [_model release];
    [_clubImg release];
    [_clubName release];
    [_clubType release];
    [_clubmember release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //club 图片
        self.clubImg = [[UIImageView alloc] init];
//        _clubImg.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_clubImg];
        [_clubImg release];
        
        //club名字
        self.clubName = [[UILabel alloc] init];
//        _clubName.backgroundColor = [UIColor orangeColor];
        _clubName.font = [UIFont boldSystemFontOfSize:15];
        [self.contentView addSubview:_clubName];
        [_clubName release];
        
        //club类型
        self.clubType = [[UILabel alloc] init];
//        _clubType.backgroundColor = [UIColor blueColor];
        _clubType.font = [UIFont systemFontOfSize:13];
        _clubType.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_clubType];
        [_clubType release];
        
        //club成员
        self.clubmember = [[UILabel alloc] init];
//        _clubmember.backgroundColor = [UIColor yellowColor];
        _clubmember.font = [UIFont systemFontOfSize:13];
        _clubmember.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_clubmember];
        [_clubmember release];
    }
    return self;

}

- (void)setModel:(WMEClubInformationModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
        [_clubImg sd_setImageWithURL:[NSURL URLWithString:_model.photoPath]];
        
        _clubName.text = _model.name;
        
        _clubmember.text = [NSString stringWithFormat:@"成员:%@",_model.member_count
                            .stringValue];
        
        _clubType.text = _model.tagsString;
    }

}



- (void)layoutSubviews
{
    [super layoutSubviews];
    _clubImg.frame = CGRectMake(10, 20, 50, 50);
    
    _clubName.frame = CGRectMake(70, 10, WIDTH - 90, 20);
    
    _clubmember.frame = CGRectMake(70, 40, WIDTH - 90, 15);
    
    _clubType.frame = CGRectMake(70, 65, WIDTH - 90, 15);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
